package com.heima.comment.controller;

import com.heima.comment.service.ICommentService;
import com.heima.model.comment.dtos.CommentDto;
import com.heima.model.comment.dtos.CommentLikeDto;
import com.heima.model.comment.dtos.CommentSaveDto;
import com.heima.model.common.dtos.ResponseResult;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @AuthOr: Anna Zhang
 * @Date:2024/8/21-21:29
 * @ClassName:com.heima.comment.controller
 * @Description:
 **/
@RestController
@RequestMapping("/api/v1/comment")
@RequiredArgsConstructor
public class ApCommentController {

    private final ICommentService commentService;


    @PostMapping("/save")
    public ResponseResult saveComment(@RequestBody CommentSaveDto saveDto){
        return commentService.saveComment(saveDto);
    }

    @PostMapping("/load")
    public ResponseResult loadComment(@RequestBody CommentDto dto){
        return commentService.loadComment(dto);
    }

    @PostMapping("/like")
    public ResponseResult likeComment(@RequestBody CommentLikeDto likeDto){
        return commentService.likeComment(likeDto);
    }
}
